import {
  ACCESS_TOKEN,
  ACCESS_SUBJECT,
  USER_INFO
} from '@/store/mutation-types'
import storage from 'store'

export const setToken = token => storage.set(ACCESS_TOKEN, token)
export const getToken = () => storage.get(ACCESS_TOKEN)
export const setSubject = subject => storage.set(ACCESS_SUBJECT, subject)
export const getSubject = () => storage.get(ACCESS_SUBJECT)
export const setUserInfo = info => storage.set(USER_INFO, info)
export const getUserInfo = () => storage.get(USER_INFO)
export const removeAllStorage = () => {
  storage.remove(ACCESS_TOKEN)
  storage.remove(ACCESS_SUBJECT)
  storage.remove(USER_INFO)
}
